﻿@using Volo.Abp.AspNetCore.Mvc.UI.Components.LayoutHook
@using Volo.Abp.AspNetCore.Mvc.UI.Theming
@using Volo.Abp.AspNetCore.Mvc.UI.Widgets.Components.WidgetStyles
@using Microsoft.Extensions.Localization
@using Microsoft.Extensions.Options
@using Volo.Abp.AspNetCore.MultiTenancy
@using Volo.Abp.AspNetCore.Mvc.AntiForgery
@using Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy.Localization
@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Components
@using Volo.Abp.AspNetCore.Mvc.UI.Widgets.Components.WidgetScripts
@using Volo.Abp.Localization
@using Volo.Abp.MultiTenancy
@using EasyAbp.Abp.AspNetCore.Mvc.UI.Theme.LYear.Themes.LYear.Components.PageAlerts
@using EasyAbp.Abp.AspNetCore.Mvc.UI.Theme.LYear.Bundling
@inject IAbpAntiForgeryManager AbpAntiForgeryManager
@inject IBrandingProvider BrandingProvider
@inject IOptions<AbpMultiTenancyOptions> MultiTenancyOptions
@inject ICurrentTenant CurrentTenant
@inject IStringLocalizer<AbpUiMultiTenancyResource> MultiTenancyStringLocalizer
@inject ITenantResolveResultAccessor TenantResolveResultAccessor
@{
    Layout = null;
    AbpAntiForgeryManager.SetCookie();
    var rtl = CultureHelper.IsRtl ? "rtl" : string.Empty;
}
<!DOCTYPE html>
<html lang="@CultureInfo.CurrentCulture.Name">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
    @await Component.InvokeLayoutHookAsync(LayoutHooks.Head.First, StandardLayouts.Account)
    <abp-style-bundle name="@LYearThemeBundles.Styles.Global"/>

    @await Component.InvokeAsync(typeof(WidgetStylesViewComponent))

    @await RenderSectionAsync("styles", false)

    @await Component.InvokeLayoutHookAsync(LayoutHooks.Head.Last, StandardLayouts.Account)

</head>
<body dir="@rtl">
    @await Component.InvokeLayoutHookAsync(LayoutHooks.Body.First, StandardLayouts.Account)
    <div id="app">
        <div>
            <!-- Main Content -->
            <div>
                <section style="margin-top: 10%;">
                    <abp-row>
                        <div class="p-4 text-center mb-1">
                            <a alt="MyProjectName" class="navbar-brand" routerlink="/" href="~/"></a>
                        </div>
                        <abp-column size-md="_5" class="mx-auto">
                            @if (MultiTenancyOptions.Value.IsEnabled &&
                          (TenantResolveResultAccessor.Result?.AppliedResolvers?.Contains(CookieTenantResolveContributor.ContributorName) == true))
                            {
                                <div class="card shadow-sm rounded mb-3">
                                    <div class="card-body px-5">
                                        <div class="row">
                                            <div class="col">
                                                <span style="font-size: .8em;" class="text-uppercase text-muted">@MultiTenancyStringLocalizer["Tenant"]</span><br />
                                                <h6 class="m-0 d-inline-block">
                                                    @if (CurrentTenant.Id == null)
                                                    {
                                                        <span>
                                                            @MultiTenancyStringLocalizer["NotSelected"]
                                                        </span>
                                                    }
                                                    else
                                                    {
                                                        <strong>@(CurrentTenant.Name ?? CurrentTenant.Id.Value.ToString())</strong>
                                                    }
                                                </h6>
                                            </div>
                                            <div class="col-auto">
                                                <a id="AbpTenantSwitchLink" href="javascript:;" class="btn btn-sm mt-3 btn-outline-primary">@MultiTenancyStringLocalizer["Switch"]</a>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            }
                            @(await Component.InvokeAsync<PageAlertsViewComponent>())
                            @RenderBody()
                        </abp-column>
                    </abp-row>
                </section>
            </div>
        </div>
    </div>
    <abp-script-bundle name="@LYearThemeBundles.Scripts.Global" />

    <script src="~/Abp/ApplicationConfigurationScript"></script>
    <script src="~/Abp/ServiceProxyScript"></script>

    @await RenderSectionAsync("scripts", false)

    @await Component.InvokeAsync(typeof(WidgetScriptsViewComponent))

    @await Component.InvokeLayoutHookAsync(LayoutHooks.Body.Last, StandardLayouts.Account)
</body>
</html>